package com.soywiz.korge.ui

import com.soywiz.korge.*
import com.soywiz.korge.view.*
import com.soywiz.korim.bitmap.*
import com.soywiz.korim.format.*
import com.soywiz.krypto.encoding.*
import kotlinx.coroutines.*

object KorgeUiSample {
    @JvmStatic
    fun main(args: Array<String>): Unit = runBlocking {
        Korge {
            uiButton(64.0, 64.0, skin = UISkin(normal = DEFAULT_CHECKED_SKIN_IMG.sliceWithSize(0, 0, 64, 64))) {
                position(130, 270)
            }
            uiButton(64.0, 64.0, skin = UISkin(normal = DEFAULT_CHECKED_SKIN_IMG.sliceWithSize(64, 0, 64, 64))) {
                position(130, 340)
            }
            uiButton(64.0, 64.0, skin = UISkin(normal = DEFAULT_CHECKED_SKIN_IMG.sliceWithSize(128, 0, 64, 64))) {
                position(130, 410)
            }
            uiButton(64.0, 64.0, skin = UISkin(normal = DEFAULT_CHECKED_SKIN_IMG.sliceWithSize(192, 0, 64, 64))) {
                position(130, 480)
            }
        }
    }

    private val DEFAULT_CHECKED_SKIN_IMG by lazy {
        PNG.decode(
            "iVBORw0KGgoAAAANSUhEUgAAAQAAAABACAYAAAD1Xam+AAAbPUlEQVR4nO2deXRUVbb/P/dWVabKiCQkEAhJaAhJwAlkSAKoAREFBYEAjo0TIvh+Nqvt9d7qfm+9n71a22e7ekk/u9XG1f1aaAUEkrQQYzCiYRQamQxCIPAjTAkhc6oqlXvv+yNU/So13koNZOC71lmLnHvqcL733L3PPufss4+QOzUfJwgBHr2RpgBDb+T1JbQCNcBhYCtQCHSo/G2/5B8TEzeg+eOk/1NS4539dsDwF5wogPnAW8CoADcw2KgCfgFs8VCuX/OPiYkb0Pyx638nCmBA8deMGJ5m/TfwJvAuMCioTQsOBgEFQARQDih2zwcEf5PJGGEyGcvDwsIHJH/s+j82Tm95PiD52yqAN4HXbkrTgoscIAwos8sfUPzDwsIHNH9u9L+NAhiQ/C1TgIXAJvuSTz61lNzcKaSMHIFOpwtqK31Fe7uBixcvsbtiL3/7n787K7II2Hzj3075P/X0MnLzpj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